<script type="text/javascript" src="<?php echo script_url('custom/cash'); ?>"></script>
<style>
	tbody.tabular tr td {text-align:center;}
	tbody.tabular tr td input{ text-align:center;}
	p.big{font-weight:bold;font-size:14px;}
	
	#comment {
	position: absolute;
	top: 0;
	/* just used to show how to include the margin in the effect */
	margin-top: 20px;
	border-top: 1px solid purple;
	padding-top: 19px;
	}

	#comment.fixed {
	  position: fixed;
	  top: 0;
	}

</style>


<div class="row">
	<div class="panel callout"><h6>Update Student Breakdown of Payments</h6></div>
	<?if(isset($system_message))echo $system_message;?>
	<?$this->load->view('layouts/student_profile_head');?>
	
	<div id="follow">
		<table class="table table-striped table-hover">
			<tr class="info">
				<td class="center ">OR Number</td>
				<td class="center">Cashier's Remarks</td>
				<td class="center">Date Of Payment</td>
				<td class="center">Amount Paid</td>
				<td class="center">Credits</td>
			</tr>
			<tr>
				<td><?=$payment_record->spr_or_no;?></td>
				<td><?=$payment_record->spr_remarks;?></td>
				<td><?=$payment_record->spr_payment_date;?></td>
				<td><input type="text" value="&#8369;<?=money(floatval($payment_record->spr_ammt_paid));?>" rate="<?=$payment_record->spr_ammt_paid;?>" id="payment_recieved" disabled></td>
				<td><input type="text" id="breakdown_remaining" disabled></td>
			</tr>
		</table>
	</div>
	
	<div id="message"></div>
	<div>&nbsp;</div>
	<div>
	<form action="<?=site_url('fees/update_payment_breakdown/'.$auth);?>" method="POST">
	<table class="data-table">
			<?if(!empty($tuit_fees)):?>
				<tbody class="tabular">
					<thead class="tabular-head">
						<tr>
							<th colspan="4" class="center">Tuition Fee</th>
						</tr>
						<tr>
							<th>Name Of Fee</th>
							<th>Amount</th>
							<th>Payment Breakdown</th>
							<th>Balance</th>
						<tr>
					</thead>
				<?foreach($tuit_fees as $t):?>
					<tr>
						<td><?=$t->sef_fee_name;?></td>
						<td><input type="text" name="fee[<?=isset($t->spb_id)?$t->spb_id:$t->sef_id;?>][fee_rate]" value="<?=money(floatval($t->sef_fee_rate));?>" disabled></td>
						<td><input type="text" name="fee[<?=isset($t->spb_id)?$t->spb_id:$t->sef_id;?>][amount_paid]"  class="breakdown_sum" id="payment_input" original_fee_value="<?=$t->sef_fee_rate;?>" fee_number="<?=isset($t->spb_id)?$t->spb_id:$t->sef_id;?>" required></td>
						<td><input type="text" id="amount_balance_<?=isset($t->spb_id)?$t->spb_id:$t->sef_id;?>"  disabled></td>
						<input type="hidden" name="fee[<?=isset($t->spb_id)?$t->spb_id:$t->sef_id;?>][remaining_balance]" id="amount_balance_hidden<?=isset($t->spb_id)?$t->spb_id:$t->sef_id;?>">
						<input type="hidden" name="fee[<?=isset($t->spb_id)?$t->spb_id:$t->sef_id;?>][fee_rate]" value="<?=money(floatval($t->sef_fee_rate));?>">
						<input type="hidden" name="fee[<?=isset($t->spb_id)?$t->spb_id:$t->sef_id;?>][fee_name]" value="<?=$t->sef_fee_name;?>">
						<input type="hidden" name="fee[<?=isset($t->spb_id)?$t->spb_id:$t->sef_id;?>][spr_id]" value="<?=$pay_id;?>">
						<input type="hidden" name="fee[<?=isset($t->spb_id)?$t->spb_id:$t->sef_id;?>][is_tuition_fee]" value="1">
						<input type="hidden" name="fee[<?=isset($t->spb_id)?$t->spb_id:$t->sef_id;?>][stud_enrollment_id]" value="<?=$enl_id;?>">
						<!--<input type="hidden" name="fee[<?=$t->spb_id;?>][key_id]" value="<?//=$t->key_id;?>">-->
					</tr>
				<?endforeach;?>
				</tbody>
			<?else:?>
				
			<?endif;?>
			
			<!-- START CCA FEES -->
			<?if(!empty($cca_fees)):?>
				<tbody class="tabular">
					<thead class="tabular-head">
						<tr>
							<th colspan="4" class="center">Matriculation Fees</th>
						</tr>
						<tr>
							<th>Name Of Fee</th>
							<th>Amount</th>
							<th>Payment Breakdown</th>
							<th>Balance</th>
						<tr>
					</thead>
				<?foreach($cca_fees as $r):?>
					<tr>
						<td><?=$r->sef_fee_name;?></td>
						<td><input type="text" name="fee[<?=isset($r->spb_id)?$r->spb_id:$r->sef_id;?>][fee_rate]" value="<?=money(floatval($r->sef_fee_rate));?>"disabled></td>
						<td><input type="text" name="fee[<?=isset($r->spb_id)?$r->spb_id:$r->sef_id;?>][amount_paid]"  class="breakdown_sum" id="payment_input" original_fee_value="<?=$r->sef_fee_rate;?>" fee_number="<?=isset($r->spb_id)?$r->spb_id:$r->sef_id;?>" required></td>
						<td><input type="text" id="amount_balance_<?=isset($r->spb_id)?$r->spb_id:$r->sef_id;?>"  disabled></td>
						<input type="hidden" name="fee[<?=isset($r->spb_id)?$r->spb_id:$r->sef_id;?>][remaining_balance]" id="amount_balance_hidden<?=isset($r->spb_id)?$r->spb_id:$r->sef_id;?>">
						<input type="hidden" name="fee[<?=isset($r->spb_id)?$r->spb_id:$r->sef_id;?>][fee_rate]" value="<?=money(floatval($r->sef_fee_rate));?>">
						<input type="hidden" name="fee[<?=isset($r->spb_id)?$r->spb_id:$r->sef_id;?>][fee_name]" value="<?=$r->sef_fee_name;?>">
						<input type="hidden" name="fee[<?=isset($r->spb_id)?$r->spb_id:$r->sef_id;?>][spr_id]" value="<?=$pay_id;?>">
						<input type="hidden" name="fee[<?=isset($r->spb_id)?$r->spb_id:$r->sef_id;?>][is_cca_fee]" value="1">
						<input type="hidden" name="fee[<?=isset($r->spb_id)?$r->spb_id:$r->sef_id;?>][stud_enrollment_id]" value="<?=$enl_id;?>">
						<!--<input type="hidden" name="fee[<?=$r->spb_id;?>][key_id]" value="<?//=$r->key_id;?>">-->
					</tr>
				<?endforeach;?>
				</tbody>
			<?else:?>
				
			<?endif;?>
			<!-- END CCA FEES -->
			
		
			<!-- START Miscellaneous FEES -->
			<?if(!empty($misc_fees)):?>
				<tbody class="tabular">
					<thead class="tabular-head">
						<tr>
							<th colspan="4" class="center">Other School Fees</th>
						</tr>
						<tr>
							<th>Name Of Fee</th>
							<th>Amount</th>
							<th>Payment Breakdown</th>
							<th>Balance</th>
						<tr>
					</thead>
				<?foreach($misc_fees as $r):?>
					<tr>
						<td><?=$r->sef_fee_name;?></td>
						<td><input type="text" name="fee[<?=isset($r->spb_id)?$r->spb_id:$r->sef_id;?>][fee_rate]" value="<?=money(floatval($r->sef_fee_rate));?>"disabled></td>
						<td><input type="text" name="fee[<?=isset($r->spb_id)?$r->spb_id:$r->sef_id;?>][amount_paid]"  class="breakdown_sum" id="payment_input" original_fee_value="<?=$r->sef_fee_rate;?>" fee_number="<?=isset($r->spb_id)?$r->spb_id:$r->sef_id;?>" required></td>
						<td><input type="text" id="amount_balance_<?=isset($r->spb_id)?$r->spb_id:$r->sef_id;?>"  disabled></td>
						<input type="hidden" name="fee[<?=isset($r->spb_id)?$r->spb_id:$r->sef_id;?>][remaining_balance]" id="amount_balance_hidden<?=isset($r->spb_id)?$r->spb_id:$r->sef_id;?>">
						<input type="hidden" name="fee[<?=isset($r->spb_id)?$r->spb_id:$r->sef_id;?>][fee_rate]" value="<?=money(floatval($r->sef_fee_rate));?>">
						<input type="hidden" name="fee[<?=isset($r->spb_id)?$r->spb_id:$r->sef_id;?>][fee_name]" value="<?=$r->sef_fee_name;?>">
						<input type="hidden" name="fee[<?=isset($r->spb_id)?$r->spb_id:$r->sef_id;?>][spr_id]" value="<?=$pay_id;?>">
						<input type="hidden" name="fee[<?=isset($r->spb_id)?$r->spb_id:$r->sef_id;?>][is_misc_fee]" value="1">
						<input type="hidden" name="fee[<?=isset($r->spb_id)?$r->spb_id:$r->sef_id;?>][stud_enrollment_id]" value="<?=$enl_id;?>">
						<!--<input type="hidden" name="fee[<?=$r->spb_id;?>][key_id]" value="<?//=$r->key_id;?>">-->
					</tr>
				<?endforeach;?>
				</tbody>
			<?else:?>
				
			<?endif;?>
			<!-- END Miscellaneous FEES -->
			
			
			<!-- START Uniform FEES -->
			<!--
			<?if(!empty($uniform)):?>
				<tbody class="tabular">	
					<thead class="tabular-head">
						<tr>
							<th colspan="4" class="center">School Uniform</th>
						</tr>
						<tr>
							<th>Name Of Fee</th>
							<th>Amount</th>
							<th>Payment Breakdown</th>
							<th>Balance</th>
						<tr>
					</thead>
				<?foreach($uniform as $r):?>
					<tr>
						<td><?=$r->sef_fee_name;?></td>
						<td><input type="text" name="fee[<?=$r->spb_id;?>][fee_rate]" value="<?=money(floatval($r->sef_fee_rate));?>"disabled></td>
						<td><input type="text" name="fee[<?=$r->spb_id;?>][amount_paid]"  class="breakdown_sum" id="payment_input" original_fee_value="<?=$r->sef_fee_rate;?>" fee_number="<?=$r->spb_id;?>" required></td>
						<td><input type="text" id="amount_balance_<?=$r->spb_id;?>"  disabled></td>
						<input type="hidden" name="fee[<?=$r->spb_id;?>][remaining_balance]" id="amount_balance_hidden<?=$r->spb_id;?>">
						<input type="hidden" name="fee[<?=$r->spb_id;?>][fee_rate]" value="<?=money(floatval($r->sef_fee_rate));?>">
						<input type="hidden" name="fee[<?=$r->spb_id;?>][fee_name]" value="<?=$r->sef_fee_name;?>">
						<input type="hidden" name="fee[<?=$r->spb_id;?>][spr_id]" value="<?=$pay_id;?>">
						<input type="hidden" name="fee[<?=$r->spb_id;?>][is_uniform_fee]" value="1">
						<input type="hidden" name="fee[<?=$r->spb_id;?>][stud_enrollment_id]" value="<?=$enl_id;?>">
						<input type="hidden" name="fee[<?=$r->spb_id;?>][key_id]" value="<?=$r->key_id;?>">
					</tr>
				<?endforeach;?>
				</tbody>
			<?else:?>
				
			<?endif;?>
			-->
			<!-- END Uniform FEES -->

			<!-- START ELECTIVE/Optional FEES -->
			<?if(!empty($elec_fees)):?>
				<tbody class="tabular">	
					<thead class="tabular-head">
						<tr>
							<th colspan="4" class="center">Optional or Additional Fees</th>
						</tr>
						<tr>
							<th>Name Of Fee</th>
							<th>Amount</th>
							<th>Payment Breakdown</th>
							<th>Balance</th>
						<tr>
					</thead>
				<?foreach($elec_fees as $r):?>
					<tr>
						<td><?=$r->sef_fee_name;?></td>
						<td><input type="text" name="fee[<?=$r->spb_id;?>][fee_rate]" value="<?=money(floatval($r->sef_fee_rate));?>"disabled></td>
						<td><input type="text" name="fee[<?=$r->spb_id;?>][amount_paid]"  class="breakdown_sum" id="payment_input" original_fee_value="<?=$r->sef_fee_rate;?>" fee_number="<?=$r->spb_id;?>" required></td>
						<td><input type="text" id="amount_balance_<?=$r->spb_id;?>"  disabled></td>
						<input type="hidden" name="fee[<?=$r->spb_id;?>][remaining_balance]" id="amount_balance_hidden<?=$r->spb_id;?>">
						<input type="hidden" name="fee[<?=$r->spb_id;?>][fee_rate]" value="<?=money(floatval($r->sef_fee_rate));?>">
						<input type="hidden" name="fee[<?=$r->spb_id;?>][fee_name]" value="<?=$r->sef_fee_name;?>">
						<input type="hidden" name="fee[<?=$r->spb_id;?>][spr_id]" value="<?=$pay_id;?>">
						<input type="hidden" name="fee[<?=$r->spb_id;?>][is_elective_fee]" value="1">
						<input type="hidden" name="fee[<?=$r->spb_id;?>][stud_enrollment_id]" value="<?=$enl_id;?>">
						<!--<input type="hidden" name="fee[<?=$r->spb_id;?>][key_id]" value="<?=$r->key_id;?>">-->
					</tr>
				<?endforeach;?>
				</tbody>
			<?else:?>
				
			<?endif;?>
			<!-- End Optional/additional FEES -->
			<!-- START OTHER FEES -->
			<?if(!empty($other_fees)):?>
				<tbody class="tabular">
					<thead class="tabular-head">
						<tr>
							<th colspan="4" class="center">Other Fees</th>
						</tr>
						<tr>
							<th>Name Of Fee</th>
							<th>Amount</th>
							<th>Payment Breakdown</th>
							<th>Balance</th>
						<tr>
					</thead>
				<?foreach($other_fees as $m):?>
					<tr>					
						<td><?=$m->sef_fee_name;?></td>
						<td><input type="text" name="fee[<?=isset($m->spb_id)?$m->spb_id:$m->sef_id;?>][fee_rate]" value="<?=money(floatval($m->sef_fee_rate));?>"disabled></td>
						<td><input type="text" name="fee[<?=isset($m->spb_id)?$m->spb_id:$m->sef_id;?>][amount_paid]"  class="breakdown_sum" id="payment_input" original_fee_value="<?=$m->sef_fee_rate;?>" fee_number="<?=isset($m->spb_id)?$m->spb_id:$m->sef_id;?>" required></td>
						<td><input type="text" id="amount_balance_<?=isset($m->spb_id)?$m->spb_id:$m->sef_id;?>"  disabled></td>
						<input type="hidden" name="fee[<?=isset($m->spb_id)?$m->spb_id:$m->sef_id;?>][remaining_balance]" id="amount_balance_hidden<?=isset($m->spb_id)?$m->spb_id:$m->sef_id;?>">
						<input type="hidden" name="fee[<?=isset($m->spb_id)?$m->spb_id:$m->sef_id;?>][fee_rate]" value="<?=money(floatval($m->sef_fee_rate));?>">
						<input type="hidden" name="fee[<?=isset($m->spb_id)?$m->spb_id:$m->sef_id;?>][fee_name]" value="<?=$m->sef_fee_name;?>">
						<input type="hidden" name="fee[<?=isset($m->spb_id)?$m->spb_id:$m->sef_id;?>][spr_id]" value="<?=$pay_id;?>">
						<input type="hidden" name="fee[<?=isset($m->spb_id)?$m->spb_id:$m->sef_id;?>][is_other_fee]" value="1">
						<input type="hidden" name="fee[<?=isset($m->spb_id)?$m->spb_id:$m->sef_id;?>][stud_enrollment_id]" value="<?=$enl_id;?>">
						<!--<input type="hidden" name="fee[<?=$m->spb_id;?>][key_id]" value="<?=$m->key_id;?>">-->
					</tr>
					
					
				<?endforeach;?>
					<tr>
					<td>&nbsp;</td>
					<td>TOTAL:</td>
					<td><input type="text" id="breakdown_total" disabled></td>
					<td>&nbsp;</td>
					</tr>
					<tr>
					<td>&nbsp;</td>
					<td>Remaining:</td>
					<td><input type="text" id="breakdown_remaining" disabled></td>
					<td>&nbsp;</td>
					</tr>
				</tbody>
			<?else:?>
				
			<?endif;?>
			
			<!-- END OTHER FEES -->
		</table>
		<div class="input-block">
			<input type="hidden" name="max_payment_breakdown" value="<?=$payment_record->spr_ammt_paid;?>">
			<input type="submit" class="button tiny" name="save_payment_breakdown" value="Save Payment Breakdown">
		</div>
	</form>
	</div>
</div>
